home *** CD-ROM | disk | FTP | other *** search
- WINDOW OFF
- REM Segment Loader Example ZBasic 3.02
- REM ©MacTutor 1986
- REM by Dave Kelly
- DIM 31 Name$(5),Vol%(5),Type&(5),Mes$(1):REM up to 5 files can be selected.
- DEFSTR LONG
- Count%=2
- Message%=FINDERINFO(Count%,Name$(0),Type&(0),Vol%(0))
- X&=MEM(-1)
- WINDOW 1,"Segment Sample",(50,100)-(475,300),257
- IF Count%<>0 THEN GOSUB "DisplayFINDERINFO"
- MENU 1,0,1,"File"
- MENU 1,1,1,"Create Data File"
- MENU 1,2,1,"Quit"
- MENU 2,0,1,"Segments"
- MENU 2,1,1,"Main Segment"
- MENU 2,2,1,"1st Segment"
- MENU 2,3,1,"2nd Segment"
- MENU 2,4,1,"3rd Segment"
- MENU 2,5,1,"Check memory available and unload unused segments"
- ON MENU GOSUB "Menuevent"
- MENU ON
- "Loop":
- GOTO "Loop"
- "Menuevent":
- Menunumber=MENU(0)
- Menuitem=MENU(1)
- MENU
- MENU OFF
- ON Menunumber GOSUB "Filemenu","Segmenu"
- MENU ON
- RETURN
- "Filemenu":
- IF Menuitem=1 THEN "Openfile"
- IF Menuitem<>2 THEN RETURN
- MENU RESET
- END
- "Openfile":
- DEF OPEN "DATADAVE"
- Filename$=FILES$(0,"Create new file as ...","Segment DATA")
- IF Filename$="" THEN RETURN
- OPEN O,#1,Filename$
- PRINT "New file named ";Filename$;" has been created.":PRINT
- PRINT "Quit the program and click on ";Filename$;" to see how the"
- PRINT "FINDERINFO function works. Select PRINT or OPEN from the Finder."
- PRINT "The FINDERINFO function will indicate what has been selected."
- PRINT "You may want to create multiple data files and try printing"
- PRINT "or opening them to see what happens."
- RETURN
- "Segmenu":
- ON Menuitem GOSUB "Main","Seg1","Seg2","Seg3","Memory"
- RETURN
- "Main":
- PRINT "This is part of the main segment"
- RETURN
- SEGMENT
- "Seg1"
- PRINT "This is part of the 1st segment"
- SEGMENT RETURN
- SEGMENT
- "Seg2"
- PRINT "This is part of the 2nd segment"
- SEGMENT RETURN
- SEGMENT
- "Seg3"
- PRINT "This is part of the 3rd segment"
- SEGMENT RETURN
- SEGMENT
- "Memory"
- X&=MEM(-1)
- PRINT "Memory = ";X&
- SEGMENT RETURN
- SEGMENT
- "DisplayFINDERINFO":
- CLS
- Mes$(0)="Data file(s) should be loaded"
- Mes$(1)="Data file(s) should be printed"
- PRINT "Message% = ";Message%;" Therefore...";Mes$(Message%)
- PRINT "Count% = ";Count%; "file(s) have been passed to this application"
- PRINT "Filenames are:"
- PRINT"Name","Type","Vol"
- FOR C=0 TO Count%-1
- PRINT Name$(C),MKI$(Type&(C)),Vol%(C)
- NEXT C
- SEGMENT RETURN
-